;;; packages.el --- ctrl-better-defaults layer packages file for Spacemacs.
;;

(defconst ctrl-better-defaults-packages
  '(
    ;;The list of Lisp packages required by the ctrl-better-defaults layer.
    (dired-mode :location built-in)
    (recentf :location built-in)))

(defun ctrl-better-defaults/post-init-recentf ()
  (progn
   (setq recentef-exclude
         '("/git-rebase-todo\\'"
           "/\\(\\(\\(COMMIT\\|NOTES\\|PULLREQ\\|TAG\\)_EDIT\\|MERGE_\\|\\)MSG\\|\\(BRANCH\\|EDIT\\)_DESCRIPTION\\)\\'"
           "COMMIT_EDITMSG\\'"
           "/root/.emacs.d/elpa"
           "/root/.emacs.d/.cache/"
           "/tmp/"
           "/ssh:"
           "/sudo:"
           "/docker:"
           "/vagrant:"
           ))

   (setq recentf-max-saved-items 1024)))

(defun ctrl-better-defaults/init-dired-mode ()
  (use-package dired-mode
    :defer t
    :init
    (progn
      (require 'dired-x)
      (require 'dired-aux)

      ;; always delete and copy recursively
      (setq dired-recursive-deletes 'always)
      (setq dired-recursive-copies 'always)

      ;; Don't show hidden files by default
      (setq-default dired-omit-files-p t)
      (setq dired-omit-files (concat dired-omit-files
                                     "\\|^\\..+$\\|\\.pyc$|^__pycache__$"))

      ;; (add-hook 'dired-load-hook (lambda()
      ;;                              ;; set the mode to hide hidden files
      ;;                              (define-key dired-mode-map (kbd ")") 'dired-omit-mode)))

      ;; when evilify dired mode, *messages* buffer will show this
      ;; Auto-evilification could not remap these functions in map ‘dired-mode-map’:
      ;; - ‘dired-do-chgrp’ originally mapped on ‘G’
      ;; see detail on
      ;; https://github.com/syl20bnr/spacemacs/blob/develop/doc/DOCUMENTATION.org#evilified-modes
      ;; https://github.com/syl20bnr/spacemacs/commit/4f700556af46dcf4bf927ddfaaab5ce25c24f185
      ;; set dired custom keymap on ctrl-better-defaults/config.el
      ;; (evilified-state-evilify-map dired-mode-map
      ;;   :mode dired-mode
      ;;   :bindings
      ;;   (kbd "C-k") 'ctrl/dired-up-directory)
      )))
;;; packages.el ends here
